package ynu.lcy.elememicroserviceuserauthservice9091.factory;



import org.springframework.stereotype.Component;
import ynu.lcy.elememicroservicecommon.enums.UserRoleEnum;
import ynu.lcy.elememicroserviceuserauthservice9091.entity.Admin;
import ynu.lcy.elememicroserviceuserauthservice9091.entity.Customer;
import ynu.lcy.elememicroserviceuserauthservice9091.entity.User;


import java.util.Objects;

@Component
public class UserBeanFactory {
    /*
    * 静态工厂
    * */
    public User getInstance(String type) {
        if (Objects.equals(type, UserRoleEnum.USER.getValue())){
            return new Customer();
        } else if (Objects.equals(type,UserRoleEnum.ADMIN.getValue())) {
            return new Admin();
        }
        return  null;
    }


}
